package org.swxjava.examples;

import java.util.Date;

public class DataTypeTest {

	public DataTypeTest() {
	}

	/**
	 * Returns the boolean true.
	 */
	public boolean testTrue() {
		return true;
	}

	/**
	 * Returns the boolean false.
	 */
	public boolean testFalse() {
		return false;
	}

	/**
	 * Returns the array ['It', 'works']
	 */
	public Object[] testArray() {
		return new String[] { "It", "works" };
	}

	/**
	 * Returns the nested array ['It', ['also'], 'works]
	 */
	public Object[] testNestedArray() {
		return new Object[] { "It", new String[] { "also" }, "works" };
	}

	/**
	 * Returns the integer 42.
	 */
	public Integer testInteger() {
		return 42;
	}

	/**
	 * Returns the float 42.12345.
	 */
	public Float testFloat() {
		return 42.12345f;
	}

	/**
	 * Returns the double 42.12345123456789
	 */
	public Double testDouble() {
		return 42.12345123456789;
	}

    /**
     * Returns the date the milliseconds 1167577200000
     */
	public Date testDate() {
		return new Date(1167577200000l);
	}
	
	/**
	 * Returns the string "It works!"
	 */
	public String testString() {
		return "It works!";
	}

	/**
	 * Returns an instance of the TestTO class with properties prop1: "A string"
	 * and prop2: 42.
	 */
	public TestTO testObject() {
		return new TestTO("A string", 42);
	}

	public TestTO testNestedObject() {
		TestTO obj = new TestTO("A string", 42);
		obj.setNestedValue(new TestTO("Nested object's string", 100));
		return obj;
	}
	
	/**
	 * Returns null.
	 */
	public Object testNull() {
		return null;
	}
}
